<template>
    <view class="content">
        <view class="item" v-for="(item, index) in list" :key="index">
            <view class="time" v-if="item.method == 3">{{item.date}}</view>
            <view class="down" v-if="item.method == 3">
                <image src="../../static/icon/price_03.png" class="price-03"></image>
                <view class="cen">
                    <view class="title">{{item.line}}</view>
                    <view>订单编号:{{item.out_trade_no}}</view>
                </view>
                <view class="right">
                    <view>
                        运费<text class="price">{{item.balance}}</text>
                    </view>
                    <view>账户余额：￥{{item.surplus_balance}}</view>
                </view>
            </view>
			
			<view class="down" v-if="item.method != 3">
			    <image src="../../static/icon/icon_01.png" class="price-03"></image>
			    <view class="cen">
			        <view class="title">{{item.line}}</view>
			        <view>{{item.date}}</view>
			    </view>
			    <view class="right">
			        <view class="price">{{item.balance}}</view>
					<view>账户余额：￥{{item.surplus_balance}}</view>
			        <!-- <view class="tip" v-if="item.coupon_num > 0">赠送{{item.coupon_num}}优惠券</view> -->
			    </view>
			</view>
        </view>
		
		<view style="height: 94rpx;padding-top: 30rpx;">
		    <u-loadmore :status="status" v-if="status != 'loadmore'" />
		</view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                status: 'loadmore', //是否显示没有更多了
                page: 1,
                list: [],
            };
        },
        onLoad() {
            this.getList()
        },
        onReachBottom() {
        	if(this.page == 1){return}
        	this.getList()
        },
        methods: {
            getList() {
            	if (this.status == 'nomore') return;
            	this.status = 'loading';
            	this.$ajax('income_details', {
            		user_token: this.$getSync('userToken'),
            		page: this.page,
            		limit: 10,
                    type: 0,//0全部 1充值
            	}).then(ret => {
            		if (ret.success == 1000) {
            			if (ret.detail && ret.detail.details && ret.detail.details.length > 0) {
            				this.list = this.list.concat(ret.detail.details);
            				this.page++;
            				this.status = 'loadmore'
            			} else {
            				this.status = 'nomore'
            			}
            		} else {
            			this.$toast(ret.msg);
            		}
            	});
            },
        }
    };
</script>

<style lang="scss">
    page{
        background-color: #fff;
    }
    .content{
        border-top: 2rpx solid #f0f0f0;
        padding: 0 30rpx;
    }
    .item{
        padding: 30rpx 0;
        border-bottom: 2rpx solid #f0f0f0;
        font-size: 24rpx;
        color: #929292;
    }
    .time{
        padding-bottom: 15rpx;
    }
    .down{
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .price-03{
        width: 68rpx;
        height: 68rpx;
        margin-right: 20rpx;
    }
    .cen{
        flex: 1;
        word-break: break-all;
        white-space: pre-line;
        padding-right: 15rpx;
    }
    .title{
        font-size: 32rpx;
        font-weight: bold;
        color: #000;
        padding-bottom: 10rpx;
    }
    .right{
        display: flex;
        flex-direction: column;
        align-items: flex-end;
    }
    .price{
        font-size: 34rpx;
        font-weight: bold;
        color: #ff5f2b;
        padding-left: 10rpx;
    }
    
    
    
    
    

</style>
